<?php
html::printPath('orgSpace.welcome-title');
$msg->printMessages();

echo html::img('frontpage-org.png', array('style' => 'vertical-align:top; float: right'));

echo '<div style="vertical-align: top; max-width: 800px">';
    echo '<p>' . text::getEscaped('orgSpace.welcomeTo') . ' ' . html::anchor('/org/myOrganization/display', $this->getAuthOrg('name')) . '.</p>';
    
    echo '<h3>' . text::getEscaped('orgSpace.howToStart') . '</h3>';

    echo '<ol>';
    echo '<li>' . text::getEscaped('orgSpace.howTo-1') . '</li>';
    echo '<li>' . text::getEscaped('orgSpace.howTo-2') . '</li>';
    echo '<li>' . text::getEscaped('orgSpace.howTo-3') . '</li>';
    echo '<li>' . text::getEscaped('orgSpace.howTo-4') . '</li>';
    echo '</ol>';

    echo '<p>' . text::getEscaped('orgSpace.thanksForHelp') . '</p>';
    echo '<p>' . text::getEscaped('orgSpace.inCaseOfProblems') . '</p>';
echo '</div>';

if ($upcomingSeminarList) {
    echo '<h3>' . text::getEscaped('orgSpace.upcomingViSeminars') . '</h3>';
    seminarHelper::printSeminarListForOrganization($upcomingSeminarList);
}

$organizerList = $this->getAuthUser('organizerList');
$representativeList = $this->getAuthUser('representativeList');
if (count($organizerList) + count($representativeList) > 1) {
    echo '<h3>' . text::getEscaped('orgSpace.otherOrganizations') . '</h3>';
    echo '<p class="description">' . text::getEscaped('orgSpace.otherOrganizations-help') . '</p>';

    if ($organizerList) {
        echo '<p>' . text::getEscaped('userSpace.youAreOrganizerOfTheseOrgs') . ':</p>';
        echo '<ul>';
        foreach ($organizerList as $organization) {
            if ($organization['id'] != $this->getAuthOrg('id')) {
                echo '<li>' . html::anchor('/auth/switchOrganization?id=' . $organization['id'], $organization['name']) . ' (' . $organization['country']['name'] . ')</li>';
            }
        }
        echo '</ul>';
    }
    
    if ($representativeList) {
        echo '<p>' . text::getEscaped('userSpace.youAreRepOfTheseOrgs') . ':</p>';
        echo '<ul>';
        foreach ($representativeList as $organization) {
            if ($organization['id'] != $this->getAuthOrg('id')) {
                echo '<li>' . html::anchor('/auth/switchOrganization?id=' . $organization['id'], $organization['name']) . '</li>';
            }
        }
        echo '</ul>';
    }
}